package com.aya.rabbitmq;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.AmqpException;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.core.RabbitAdmin;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.support.CorrelationData;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
@Service
public class MqProducer
{
    @Resource
    RabbitTemplate rabbitTemplate;

    public void send(String routingKey, Message message) throws AmqpException {
        rabbitTemplate.send(routingKey, message);
    }

    public void send(String exchange, String routingKey, Object message) throws AmqpException {
        rabbitTemplate.convertAndSend(exchange, routingKey, message);
    }

}
